package com.vertx.core.tcp;

import io.vertx.core.Vertx;
import io.vertx.core.net.NetServerOptions;

/**
 * @version v1.0
 * @Description: TODO(一句话描述该类的功能)
 * @Author: TongRui乀
 * @Date: 2021/5/10 5:11 下午
 */
public class VertxNetServer {

    public static void main(String[] args) {

        NetServerOptions options = new NetServerOptions();

        options.setPort(10086);
        options.setLogActivity(true);

        var server = Vertx.vertx().createNetServer(options);

        server.connectHandler(socket->{
            socket.handler(buffer->{
                System.out.println(buffer.toString());
            });
        });

        server.listen(h->{
            if (h.succeeded()) {
                System.out.println("server started success listen port: " + h.result().actualPort());
            }
        });



    }

}
